]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
networkAgent: Advise the user to push a WPS button on their router
authorLubomir Rintel <lkundrak@v3.sk>
Thu, 27 Jul 2017 10:15:29 +0000 (12:15 +0200)
committerBenjamin Berg <bberg@redhat.com>
Fri, 25 Jan 2019 14:25:26 +0000 (15:25 +0100)
When connecting to a Wi-Fi router that supports the WPS button method
(PBC, push button connection) the user can simply press the button on
the router. Show an explanation in the PSK prompt when this is
possible.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/329

js/ui/components/networkAgent.js

index 7a6011ce997c62fca47bb85c861cde6649c39c25..709d1c2737029a0d57c5c79bab8ec24b95c38a96 100644 (file)
@@ -21,7 +21,7 @@ const ShellEntry = imports.ui.shellEntry;
 const VPN_UI_GROUP = 'VPN Plugin UI';
 
 var NetworkSecretDialog = class extends ModalDialog.ModalDialog {
-    constructor(agent, requestId, connection, settingName, hints, contentOverride) {
+    constructor(agent, requestId, connection, settingName, hints, flags, contentOverride) {
         super({ styleClass: 'prompt-dialog' });
 
         this._agent = agent;
@@ -105,6 +105,18 @@ var NetworkSecretDialog = class extends ModalDialog.ModalDialog {
 
         contentBox.messageBox.add(secretTable);
 
+        if (flags & NM.SecretAgentGetSecretsFlags.WPS_PBC_ACTIVE) {
+            let descriptionLabel = new St.Label({ style_class: 'prompt-dialog-description',
+                                                  text: _("Alternatively you can connect by pushing the “WPS” button on your router.") });
+            descriptionLabel.clutter_text.line_wrap = true;
+            descriptionLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
+
+            messageBox.add(descriptionLabel,
+                           { y_fill:  true,
+                             y_align: St.Align.START,
+                             expand: true });
+        }
+
         this._okButton = { label:  _("Connect"),
                            action: this._onOk.bind(this),
                            default: true
@@ -350,6 +362,7 @@ var VPNRequestHandler = class {
         this._agent = agent;
         this._requestId = requestId;
         this._connection = connection;
+        this._flags = flags;
         this._pluginOutBuffer = [];
         this._title = null;
         this._description = null;
@@ -568,7 +581,7 @@ var VPNRequestHandler = class {
 
         if (contentOverride && contentOverride.secrets.length) {
             // Only show the dialog if we actually have something to ask
-            this._shellDialog = new NetworkSecretDialog(this._agent, this._requestId, this._connection, 'vpn', [], contentOverride);
+            this._shellDialog = new NetworkSecretDialog(this._agent, this._requestId, this._connection, 'vpn', [], this._flags, contentOverride);
             this._shellDialog.open(global.get_current_time());
         } else {
             this._agent.respond(this._requestId, Shell.NetworkAgentResponse.CONFIRMED);
@@ -738,7 +751,7 @@ var NetworkAgent = class {
             return;
         }
 
-        let dialog = new NetworkSecretDialog(this._native, requestId, connection, settingName, hints);
+        let dialog = new NetworkSecretDialog(this._native, requestId, connection, settingName, hints, flags);
         dialog.connect('destroy', () => {
             delete this._dialogs[requestId];
         });